<?php

	include_once('Commons.php');

	$keywords = param('w');
	
	$sql = "SELECT MATCH (p.name,p.description) AGAINST ('$keywords')+MATCH (a.name,a.description) AGAINST ('$keywords') AS 'revelance',p.*,u.username,a.path AS 'albumPath',a.name AS 'albumName'
			FROM photo p
			JOIN album a ON p.album=a.id
			JOIN user u ON a.user=u.id
			WHERE MATCH (p.name,p.description) AGAINST ('$keywords')
			OR MATCH (a.name,a.description) AGAINST ('$keywords')
			ORDER BY revelance DESC;";
			
	$results = selectQuery($sql);

	require('AlbumViews/SearchResults.php');

?>